import os

names = ['.nomedia', 'aaa.jpg', 'bbb.JPG']

for nm in names:
    r = os.path.splitext(nm)
    print(r)
